Revert "Fix for a race condition in URLSession (#949)" #1188
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This reverts commit 015ded4.
The reason to revert this is that it this pretty certainly works around another bug (SR-5759) and IMHO introduces two new bugs instead.
Dispatch Sources should be cancellable independently. If you have two DispatchSources watching for events on one and the same PR, the should be independent. That was seemingly the problem that was seen here, see the original bug and the discussion in #949.
The two new bugs introduced:
self.cancelInProgress?.wait()
is introduced when creating a_MultiHandle
. Creating a large number of_MultiHandle
s concurrently could lead to a lot of threads being blocked in the wait. That might exhaust libdispatch's thread pool which might then lead to the cancellation handlers never been fully runCFURLSessionMultiHandleAssign
is run on the wrong thread (commandQueue.async
)this should only be merged when SR-5759 is done.